Release 1.19.0#53
Merged
Merged
Conversation
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
refreshBentoBoxVaultHook() assumed BentoBox already held a VaultHook it could re-hook. In the standalone case that is never true: BentoBox hooks Vault during its early hooks, before addons enable, so when InvSwitcher is the only economy that early hook fails for lack of any economy and is discarded by HooksManager. getVault() then stays empty and the refresh was a silent no-op, leaving Bank and the rest of BentoBox unable to see our economy. When getVault() is empty, register a fresh VaultHook now that our provider is live, so getVault() is populated for economy consumers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Admin eco give/set/take on an offline player reported a stale balance (e.g. "New balance: 0.00" after giving 2000). The success message re-read the balance from the database, which reloaded the offline player fresh before the asynchronous save had flushed, returning the pre-transaction value. Report the balance from the EconomyResponse the transaction returned instead, which is authoritative. Also harden the underlying offline read-after-write path: getStorageObject loaded an independent transient copy for offline players on every call, so two rapid sequential economy writes could each load before the first save flushed, losing the first update. Track offline saves in flight in a pending-saves map and reuse that object for follow-up reads/writes until the last save flushes, then drop it so a later login still reloads fresh. No main-thread blocking, no indefinite caching of offline players. Add a regression test for the offline read-after-write path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Main code: - InvEconomy: drop redundant @deprecated from the Vault interface overrides (suppress the unavoidable deprecation/removal warnings at class level), extract duplicated debug literals into constants, and replace nested ternaries in debug routing with a routeSuffix() helper. - Store: merge nested if in island-key migration; replace if/containsKey in getStat UNTYPED branch with Optional.ifPresent. - Remove unused import in InvSwitcherPladdon. Tests: - Remove the 'public' modifier from JUnit 5 test classes and annotated methods (S5786). - Add assertDoesNotThrow assertions to four clear-stored tests that had none. - Remove redundant local Island mocks that shadowed the @mock field. - Remove unused 'server' locals, unused imports, and unnecessary 'throws Exception' declarations. Left intentionally: S110 (command class depth is inherent to BentoBox's CompositeCommand hierarchy), S3776 (cognitive complexity on core inventory methods - refactoring risks regressions), and S5738 (calls to deprecated Bukkit.getOfflinePlayer required to implement Vault's name-based methods). All 124 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Release 1.19.0.
Highlights
Standalone economy now works without a separate economy plugin
fix: register a fresh VaultHook when BentoBox has none— InvSwitcher registers its own per-world Vault economy, but BentoBox hooks Vault during early hooks (before addons enable). When InvSwitcher was the only economy, that early hook failed and was discarded, sogetVault()stayed empty and economy-dependent addons (e.g. Bank) disabled themselves with "Vault is required". InvSwitcher now registers a freshVaultHookonce its provider is live, so it works as a standalone economy.Companion PRs harden this on the framework side: BentoBoxWorld/BentoBox#2995 (retry the Vault hook after addons enable) and BentoBoxWorld/Bank#67 (retry before disabling).
Correct balance reported for offline economy transactions
fix: report offline economy balances correctly and harden offline saves— admineco give/set/takeon an offline player reported a stale balance (e.g. "New balance: 0.00" after giving 2000) because the success message re-read the balance from the database before the asynchronous save had flushed. The commands now report the authoritative balance returned by the transaction itself.The same change hardens the underlying offline read-after-write path: offline saves are tracked in flight so two rapid sequential transactions can't load independent stale copies and lose an update — without blocking the main thread or caching offline players indefinitely. Adds a regression test.
Commits
d929649fix: register a fresh VaultHook when BentoBox has nonea15c645fix: report offline economy balances correctly and harden offline savesf1bd4c2chore: bump version to 1.19.0Full test suite: 124/124 passing.
🤖 Generated with Claude Code